<%@ page import="com.jsp.pojo.Person" %>
<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.Map" %>
<%@ page import="java.util.HashMap" %><%--
  Created by IntelliJ IDEA.
  User: wzm
  Date: 2023/5/6
  Time: 9:36
  To change this template use File | Settings | File Templates.
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<html>
<head>
	<title>Title</title>
</head>
<body>
<%--EL表达式搜索四个域对象数据的顺序--%>
<%
	pageContext.setAttribute("key1","pageContext");
	request.setAttribute("key2","request");
	session.setAttribute("key3","session");
	application.setAttribute("key","application");
%>
<%--当四个域对象都是一个key时 表达式优先获取范围较小的--%>

${key}

<hr>

<%--EL输出对象的属性--%>
<%
	Person person = new Person();
    person.setName("张三");
	person.setPhones(new String[]{"110","119","120"});

	List<String> city = new ArrayList<>();
    city.add("北京");
    city.add("上海");
    city.add("深圳");

    person.setCitys(city);

	Map<String,Object> map = new HashMap<>();
    map.put("key1","value1");
    map.put("key2","value2");
    map.put("key3","value3");

    person.setMap(map);
    request.setAttribute("person",person);
%>

<%--对象需要存储在域对象中才能输出--%>
输出person对象：${person} <br>
输出person对象的name属性：${person.name} <br>
输出person对象的数组属性：${person.phones[0]} <br>
输出person对象的list属性：${person.citys} <br>
输出person对象的list属性中某个元素：${person.citys[1]} <br>
输出person对象的map属性：${person.map} <br>
输出person对象的map属性某个元素：${person.map.key2} <br>









</body>
</html>
